﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using eStock.hControl;
using HCommon;
namespace eStock
{
    public partial class frmStockReportSum : hForm
    {
        public frmStockReportSum()
        {
            InitializeComponent();
            //this.QueryButton = btnFind;
            this.datFromDate.Value = DateTime.Now.AddMonths(-1);
        }

        private void btnFind_Click(object sender, EventArgs e)
        {
            LoadGrid();
        }

        private void LoadGrid()
        {
            try
            {
                if (datToDate.Value.ToString().Trim().Length == 0)
                {
                    Dialog.ShowMess(Dialog.mType.warn, "Vui lòng nhập Ngày tra cứu (đến ngày)");
                    return;
                }
                DataTable dt = new DataTable();
                dt = Dao.Get_Table("Exec spStockReportSum '" + datFromDate.Value.ToString("yyyyMMdd") + "','" + datToDate.Value.ToString("yyyyMMdd") + "','" + txtItemCd.Text + "','" + cboKind.SelectedValue.ToString() + "'");
                grdReport.DataSource = dt;
            }
            catch (Exception ex)
            {
                Common.GhiLog("LoadGrid", ex);
                Dialog.ShowMess(Dialog.mType.err, ex.Message);
            }
        }

        private void frmStockReportSum_Load(object sender, EventArgs e)
        {
            Common.LoadCombo(cboKind, "RPT", true);
            LoadGrid();
        }
    }
}
